//package com.xiao.foundation.security;
//
//import com.xiao.foundation.utils.UserAuthUtil;
//import org.springframework.data.domain.AuditorAware;
//import org.springframework.stereotype.Component;
//
//import java.util.Optional;
//
///**
// * Implementation of {@link AuditorAware} based on Spring Security.
// */
//@Component("springSecurityAuditorAware")
//public class SpringSecurityAuditorAware implements AuditorAware<String> {
//
//    @Override
//    public Optional<String> getCurrentAuditor() {
//        Long userId = UserAuthUtil.getCurrentUserId();
//        if (userId == null) {
//            return SecurityUtils.getCurrentUserLogin();
//        } else {
//            return Optional.of(String.valueOf(userId));
//        }
//    }
//}
